package ynu.beggar.server.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ynu.beggar.server.dao.BulletinDao;
import ynu.beggar.server.entities.DO.BulletinDO;
import ynu.beggar.server.entities.PO.BulletinPO;
import ynu.beggar.server.service.AdminService;
import ynu.beggar.server.utils.JsonData;

@Service
public class AdminServiceImpl implements AdminService {

    private BulletinDao bulletinDao;

    @Autowired
    public void setBulletinDao(BulletinDao bulletinDao) {
        this.bulletinDao = bulletinDao;
    }

    @Override
    public JsonData createBulletin(BulletinDO bulletinDO) {
        BulletinPO bulletinPO = new BulletinPO(bulletinDO);
        bulletinDao.save(bulletinPO);
        return JsonData.buildSuccess("添加公告成功");
    }
}
